package cn.kgc.javaweb.servlet;

import cn.kgc.javaweb.entity.Role;
import cn.kgc.javaweb.service.RoleService;
import cn.kgc.javaweb.service.RoleServiceImpl;
import cn.kgc.javaweb.utils.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/6/28
 */
@WebServlet("/role")
public class RoleServlet extends BaseServlet {
    private RoleService roleService = new RoleServiceImpl();

    protected void selectAll(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        List<Role> roles = roleService.findAllRoles();

        ResponseUtil.write(resp, roles);

    }
}
